package cn.com.djin.ssm.entity;

import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * 
 * @author djin
 * 商品实体类
 */
@JsonIgnoreProperties(value = { "hibernateLazyInitializer", "handler" })
public class Good extends BaseEntity {

	private static final long serialVersionUID = 1L;

	//商品id
	private Integer gid;  
	//商品名
	private String gname;
	//价格
	private Double price;  
	//商品折扣
	private Double discount;  
	//商品简介
	private String gdesc;  
	//商品封面图片地址
	private String gpicpath;  
	//商品上架时间
	@JsonFormat(pattern="yyyy/MM/dd",timezone="GMT+8")
	private Date makedate;
	//商品下架时间
	@JsonFormat(pattern="yyyy/MM/dd",timezone="GMT+8")
	private Date enddate;
	//商品状态
	private Integer goodState;
	//销量
	private Integer sales;  
	//收藏次数
	private Integer collection;  
	//商品类型对象
	private GoodType goodType;
	//商品集合
	private List<GoodNum> GoodNums;
	//格式化商品类型名称
	private String goodtypeName;
	//颜色id
	private Integer gcid;
	//尺寸id
	private Integer gsid;
	
	public Integer getGid() {
		return gid;
	}
	public void setGid(Integer gid) {
		this.gid = gid;
	}
	public String getGname() {
		return gname;
	}
	public void setGname(String gname) {
		this.gname = gname;
	}
	public Double getPrice() {
		return price;
	}
	public void setPrice(Double price) {
		this.price = price;
	}
	public String getGdesc() {
		return gdesc;
	}
	public void setGdesc(String gdesc) {
		this.gdesc = gdesc;
	}
	public String getGpicpath() {
		return gpicpath;
	}
	public void setGpicpath(String gpicpath) {
		this.gpicpath = gpicpath;
	}
	public Date getMakedate() {
		return makedate;
	}
	public void setMakedate(Date makedate) {
		this.makedate = makedate;
	}
	public GoodType getGoodType() {
		return goodType;
	}
	public void setGoodType(GoodType goodType) {
		this.goodType = goodType;
	}
	public Double getDiscount() {
		return discount;
	}
	public void setDiscount(Double discount) {
		this.discount = discount;
	}
	public Integer getSales() {
		return sales;
	}
	public void setSales(Integer sales) {
		this.sales = sales;
	}
	public Integer getCollection() {
		return collection;
	}
	public void setCollection(Integer collection) {
		this.collection = collection;
	}
	public Date getEnddate() {
		return enddate;
	}
	public void setEnddate(Date enddate) {
		this.enddate = enddate;
	}
	public Integer getGoodState() {
		return goodState;
	}
	public void setGoodState(Integer goodState) {
		this.goodState = goodState;
	}
	public List<GoodNum> getGoodNums() {
		return GoodNums;
	}
	public void setGoodNums(List<GoodNum> goodNums) {
		GoodNums = goodNums;
	}
	public String getGoodtypeName() {
		if(this.goodType!=null){
			this.goodtypeName = this.goodType.getTname();
		}else{
			this.goodtypeName = "";
		}
		return goodtypeName;
	}
	public void setGoodtypeName(String goodtypeName) {
		this.goodtypeName = goodtypeName;
	}
	public Integer getGcid() {
		return gcid;
	}
	public void setGcid(Integer gcid) {
		this.gcid = gcid;
	}
	public Integer getGsid() {
		return gsid;
	}
	public void setGsid(Integer gsid) {
		this.gsid = gsid;
	}
	@Override
	public String toString() {
		return "Good [gid=" + gid + ", gname=" + gname + ", price=" + price + ", discount=" + discount + ", gdesc="
				+ gdesc + ", gpicpath=" + gpicpath + ", makedate=" + makedate + ", enddate=" + enddate + ", goodState="
				+ goodState + ", sales=" + sales + ", collection=" + collection + ", goodType=" + goodType
				+ ", GoodNums=" + GoodNums + "]";
	}
	
}
